package com.mccken.designpattern.chain.china2;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2023-01-02 23:17
 **/
public class Client {
	public static void main(String[] args) {
		Approver wjzhang = new Director("张无忌"); 
		Approver gyang = new VicePresident("杨过"); 
		Approver jguo = new President("郭靖"); 
		Approver meeting = new Congress("董事会");
		Approver rhuang = new Manager("黄蓉");
		
		
		// 创建责任链
		wjzhang.setSuccessor(jguo);
//		rhuang.setSuccessor(gyang);
//		gyang.setSuccessor(jguo);
		jguo.setSuccessor(meeting);
		
		// 创建采购单
		PurchaseRequest req1 = PurchaseRequest.builder()
				.amount(45000)
				.number(10001)
				.purpose("购买倚天剑")
				.build();
		
		PurchaseRequest req2 = PurchaseRequest.builder()
				.amount(60000)
				.number(10002)
				.purpose("购买屠龙刀")
				.build();
		
		PurchaseRequest req3 = PurchaseRequest.builder()
				.amount(160000)
				.number(10003)
				.purpose("购买九阳正经")
				.build();
		
		PurchaseRequest req4 = PurchaseRequest.builder()
				.amount(800000)
				.number(10004)
				.purpose("购买桃花岛")
				.build();
		
		wjzhang.processRequest(req1);
		wjzhang.processRequest(req2);
		wjzhang.processRequest(req3);
		wjzhang.processRequest(req4);
		
		
	}
}
